import '../item_style.dart';
import '../tooltip.dart';
import 'series.dart';

import 'package:json_annotation/json_annotation.dart';

part 'bar_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BackgroundStyle {
  var color;
  var borderColor;
  var borderWidth;
  var borderType;
  var borderRadius;
  var shadowColor;
  var shadowOffsetX;
  var shadowOffsetY;
  var opacity;

  BackgroundStyle(
      {this.color,
      this.borderColor,
      this.borderWidth,
      this.borderType,
      this.borderRadius,
      this.shadowColor,
      this.shadowOffsetX,
      this.shadowOffsetY,
      this.opacity});

  factory BackgroundStyle.fromJson(Map<String, dynamic> json) =>
      _$BackgroundStyleFromJson(json);

  Map<String, dynamic> toJson() => _$BackgroundStyleToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BarEmphasis {
  var focus;
  var blurScope;
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;

  BarEmphasis(
      {this.focus, this.blurScope, this.label, this.labelLine, this.itemStyle});

  factory BarEmphasis.fromJson(Map<String, dynamic> json) =>
      _$BarEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$BarEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BarBlurSelectEmphasis {
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;

  BarBlurSelectEmphasis({this.label, this.labelLine, this.itemStyle});

  factory BarBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$BarBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$BarBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BarData {
  var name;
  var value;
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;
  BarBlurSelectEmphasis? emphasis;
  BarBlurSelectEmphasis? blur;
  BarBlurSelectEmphasis? select;

  BarData(
      {this.name,
      this.value,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select});

  factory BarData.fromJson(Map<String, dynamic> json) =>
      _$BarDataFromJson(json);

  Map<String, dynamic> toJson() => _$BarDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BarSeries extends Series {
  var id;
  var type = 'bar';
  var name;
  var coordinateSystem;
  var xAxisIndex;
  var yAxisIndex;
  var roundCap;
  var showBackground;
  BackgroundStyle? backgroundStyle;
  SeriesLabel? label;
  LabelLine? labelLine;
  ItemStyle? itemStyle;
  LabelLayout? labelLayout;
  BarBlurSelectEmphasis? blur;
  BarBlurSelectEmphasis? select;
  var selectedMode;

  var stack;
  var sampling;
  var cursor;
  var barWidth;
  var barMaxWidth;
  var barMinWidth;
  var barMinHeight;
  var barMinAngle;
  var barGap;
  var barCategoryGap;
  var large;
  var largeThreshold;
  var progressive;
  var progressiveThreshold;
  var progressiveChunkMode;
  var dimensions;
  var encode;
  var seriesLayoutBy;
  var datasetIndex;

  List<BarData>? data;
  var clip;
  var zlvel;
  var z;
  var silent;

  var animation;
  var animationThreshold;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  var animationDurationUpdate;
  var animationEasingUpdate;
  var animationDelayUpdate;
  Tooltip? tooltip;

  BarSeries(
      {this.id,
      this.name,
      this.coordinateSystem,
      this.xAxisIndex,
      this.yAxisIndex,
      this.roundCap,
      this.showBackground,
      this.backgroundStyle,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.labelLayout,
      this.blur,
      this.select,
      this.selectedMode,
      this.stack,
      this.sampling,
      this.cursor,
      this.barWidth,
      this.barMaxWidth,
      this.barMinWidth,
      this.barMinHeight,
      this.barMinAngle,
      this.barGap,
      this.barCategoryGap,
      this.large,
      this.largeThreshold,
      this.progressive,
      this.progressiveThreshold,
      this.progressiveChunkMode,
      this.dimensions,
      this.encode,
      this.seriesLayoutBy,
      this.datasetIndex,
      this.data,
      this.clip,
      this.zlvel,
      this.z,
      this.silent,
      this.animation,
      this.animationThreshold,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.animationDurationUpdate,
      this.animationEasingUpdate,
      this.animationDelayUpdate,
      this.tooltip});

  factory BarSeries.fromJson(Map<String, dynamic> json) =>
      _$BarSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$BarSeriesToJson(this);
}
